using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using SiteECSWeb;

public partial class Authorities_AddAuthorHead : PageBase
{
    protected void Page_Load(object sender, EventArgs e)
    {
        #region SiteMap
        this.SiteMapNodeProvider = SiteMapProviderNames.ListMXmlSiteMapProvider.ToString();
        SiteMapPath1.SiteMapProvider = SiteMapNodeProvider;
        #endregion
    }

    protected void lnkbtnAddCust_Click(object sender, EventArgs e)
    {
        Panel3.Visible = true;
        ModalPopupExtender1.Show();
    }
    protected void btnYes_Click(object sender, EventArgs e)
    {
        int AuthID;
        AuthoritiesBLL authAPI = new AuthoritiesBLL();
        AuthID = authAPI.AddAuthorty(txt_AuthNameAr.TextBoxData,
            txt_AuthAddressAr.TextBoxData, txt_AuthNameEn.TextBoxData, txt_AuthAddressEn.TextBoxData,
            txt_AuthPhone.TextBoxData, txt_AuthPhone2.TextBoxData, txt_AuthFax.TextBoxData,
            txt_AuthFax2.TextBoxData, txt_AuthEmail.TextBoxData, txt_AuthWsite.TextBoxData,
            int.Parse(ddlAuthTypes.SelectedItem.Value), 2175);

        if (AuthID > -1)
        {
            cddlAuthName.UseContextKeyCascade = true;
            cddlAuthName.SelectedValueCascade = AuthID.ToString();
            UpdatePanel1.Update();
        }
        ModalPopupExtender1.Hide();
    }
    protected void lbtnAdd_Click(object sender, EventArgs e)
    {
        if (!IsPageRefresh)
        {
            HeadAuthorsBLL HeadAuthAPI = new HeadAuthorsBLL();
            int HeadAuthID= HeadAuthAPI.AddHeadAuthors(ddlAuthorHeadPreTitleAr.SelectedItem.Value,
                txt_AuthorHeadNmAr.TextBoxData, txt_AuthorHeadTitleAr1.TextBoxData,
                txt_AuthorHeadTitleAr2.TextBoxData, ddlAuthorHeadPreTitleEn.SelectedItem.Value,
                txt_AuthorHeadNmEn.TextBoxData, txt_AuthorHeadTitleEn1.TextBoxData,
                txt_AuthorHeadTitleEn2.TextBoxData, txt_AuthorHeadPhone.TextBoxData,
                txt_AuthorHeadFax.TextBoxData, txt_AuthorHeadEmail.TextBoxData,
                int.Parse(cddlAuthName.dllListItemsValue));

            if (HeadAuthID != -1)
            {
                lbl_AuthName.Text = cddlAuthName.dllListItemsText;
                lbl_AuthorHeadPreTitleAr.Text = ddlAuthorHeadPreTitleAr.SelectedItem.Value;
                lbl_AuthorHeadNmAr.Text = txt_AuthorHeadNmAr.TextBoxData;
                lbl_AuthorHeadTitleAr1.Text = txt_AuthorHeadTitleAr1.TextBoxData;
                lbl_AuthorHeadTitleAr2.Text = txt_AuthorHeadTitleAr2.TextBoxData;
                lbl_AuthorHeadPreTitleEn.Text = ddlAuthorHeadPreTitleEn.SelectedItem.Value;
                lbl_AuthorHeadTitleAr1.Text = txt_AuthorHeadTitleAr1.TextBoxData;
                lbl_AuthorHeadTitleEn2.Text = txt_AuthorHeadTitleEn2.TextBoxData;
                lbl_AuthorHeadPhone.Text = txt_AuthorHeadPhone.TextBoxData;
                lbl_AuthorHeadFax.Text = txt_AuthorHeadFax.TextBoxData;
                lbl_AuthorHeadEmail.Text = txt_AuthorHeadEmail.TextBoxData;

                //lnkEdit.NavigateUrl = Helper.NavURLParamsIntVirtualName(HeadAuthID,
                //    Globals.Settings.VirtualNamesInfo.);
                //lnkReport.NavigateUrl = Helper.NavURLParamsIntVirtualName(TrdaffSubID,
                //    Globals.Settings.VirtualNamesInfo.TradAffectSubReport);

                MultiView1.ActiveViewIndex += 1;
            }
            TrackRefreshState();
        }
        TrackRefreshState();
    }
}
